package whf.framework.web.ui;

import java.util.Map;

import whf.framework.util.Utils;

/**
 * @author King
 *
 */
@SuppressWarnings("serial")
public class AbstractUIContainer extends AbstractUIElement implements UIContainer {
	private Map<String, UIElement> childrenElements = Utils.newHashMap();
	
	private String templateName;

	public void addChildElement(String childName, UIElement child) {
		this.childrenElements.put(childName, child);
	}

	public Map<String, UIElement> getChildrenElements() {
		return this.childrenElements;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}
	
	public Template getTemplate() {
		return TemplateFactory.getTemplate(this.templateName);
	}

//	public int doEndTag() throws JspException {
//		UIContainer container = this.getParentContainer();
//		BodyContent bodyContent = this.getBodyContent();
//		this.htmlContent = bodyContent.getString();
//		if(container != null) {
//			container.addChildElement(this.replaceHolderName, this);
//		}
//		return SKIP_BODY;
//	}
}
